﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAPbouiCOM;
using SAPbobsCOM;

namespace BoAddonBiz_FreightForwarder
{
    /// <summary>
    /// 危险品类别
    /// </summary>
    /// <Modified>WangPeng</Modified>
    class B1Form_Dangerous : SAPBoAddon.B1Form
    {
        protected override bool BeforeSaveCheckFormData()
        {
            #region 保存前自动流水Code
            Recordset rs = this.SBOCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
            rs.DoQuery("select max(CAST(Code AS INT)) as MAX from [@AVA_FF_ODCM]");
            int max = 1;
            if (rs.Fields.Item("MAX").Value.ToString().Trim().Length > 0)
            {
                max = Convert.ToInt32(rs.Fields.Item("MAX").Value.ToString().Trim()) + 1;
            }
            this.CurrentForm.DataSources.DBDataSources.Item("@AVA_FF_ODCM").SetValue("Code", 0, max.ToString());
            #endregion

            return true;
        }
        public B1Form_Dangerous()
        {

        }
        #region 继承基类
        protected override void FormEditModeChange(SAPBoAddon.frmItemEditMode frmEditMode)
        {
        }
        protected override void FormInfoSetting(SAPBoAddon.B1FormSetting FormSetting)
        {
            FormSetting.FormType = B1FormTypes.ado_AVA_FF_Dangerous;
            FormSetting.FormFileName = B1FormTypes.ado_AVA_FF_Dangerous.ToString() + "Form.srf";
        }
        protected override void InitializeForm(SAPBoAddon.B1FormInitializePar InitPar)
        {
        }
        #endregion
    }
}
